<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="utf-8" />
    <title>switch语句</title>
    <script>
        /*
            switch(表达式){
                case 值1:
                    语句体1;    
                case 值2：
                    语句体2;
                 ....
                 
                default:
                    如果所有case都无法匹配，就执行default语句 
            }
        */

        var week = 8;

        switch (week) {
            case 1:
                console.log("星期一");
                break;
            case 2:
                console.log("星期二");
                break;
            case 3:
                console.log("星期三");
                break;
            case 4:
                console.log("星期四");
                break;
            case 5:
                console.log("星期五");
                break;
            case 6:
                console.log("星期六");
                break;
            case 7:
                console.log("星期日");
                break;
            default:
                console.log("数字有误");
        }
    </script>
</head>

<body>
</body>